package leetcodecompetition.D375;

/**
 * @Author: Siantar
 * @Date: 2023-12-10-10:32
 * @Description: 1.0
 */
public class T100143 {
    public int countTestedDevices(int[] batteryPercentages) {
        int n = batteryPercentages.length, res = 0;
        for (int i = 0; i < n; i++) {
            if (batteryPercentages[i] > 0) {
                for (int j = i + 1; j < n; j++) {
                    batteryPercentages[j] = Math.max(0, batteryPercentages[j] - 1);
                }
                res++;
            }
        }
        return res;
    }
}
